package com.fwmagic.spark.core.action

import org.apache.spark.{SparkConf, SparkContext}

/**
  * 统计数字的和
  */
object SumDemo {
    def main(args: Array[String]): Unit = {
        val conf = new SparkConf()
                .setAppName(this.getClass.getSimpleName)
                .setMaster("local[*]")

        val sc = new SparkContext(conf)

        val rdd1 = sc.makeRDD(1 to 100)

        val sumed: Double = rdd1.sum()

        println(sumed)
        sc.stop()
    }
}
